package com.szh.htmltopdf.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyRedissonConfig {

    /**
     * 所有对redisson的操作都是通过 redissonClient进行操作
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson()  {
        // 指定redis地址创建 redis://127.0.0.1:7181
        Config config = new Config();
        // 默认看门狗时间
        config.setLockWatchdogTimeout(30_000);
        config.useSingleServer().setAddress("redis://192.168.216.128:6379");
        return Redisson.create(config);
    }
}